<template>
  <div ref="lineBar" class="warp" />
</template>>

<script>
import * as echarts from 'echarts'

export default {
  name: 'LineBar',
  mounted() {
    var myChart = echarts.init(this.$refs.lineBar)
    myChart.setOption({
      xAxis: {

        show: false,
        // 设置最小值与最大值
        min: 0,
        max: 100
      },
      yAxis: {
        type: 'category',
        show: false
      },
      grid: {
        left: 0,
        right: 0,
        bottom: 0,
        top: 0
      },
      series: [
        {
          data: [78],
          type: 'bar',
          // 设置柱状图的宽度
          barWidth: '10px',
          // 柱状图的颜色
          color: '#bfa',
          // 柱状图的背景颜色
          showBackground: true,
          backgroundStyle: {
            color: '#eee'
          },
          // 柱状图的标签 自定义一个竖线
          label: {
            show: true,
            formatter: '|',
            color: 'blue',
            position: 'right'
          }
        }
      ]
    })
  }
}
</script>

<style scoped>
.warp{
  width: 100%;
  height: 50px;
}
</style>
